package com.ruoyi.customer.mapper;

import java.util.List;
import com.ruoyi.system.api.domain.ShippingAddress;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * 收货地址Mapper接口
 * 
 * @author luogongquan
 * @date 2024-09-10
 */
public interface ShippingAddressMapper 
{
    /**
     * 查询收货地址
     * 
     * @param id 收货地址主键
     * @return 收货地址
     */
    public ShippingAddress selectShippingAddressById(Long id);


    public ShippingAddress getDefaultAddress(Long id);

    /**
     * 查询收货地址列表
     * 
     * @param shippingAddress 收货地址
     * @return 收货地址集合
     */
    public List<ShippingAddress> selectShippingAddressList(ShippingAddress shippingAddress);

    /**
     * 新增收货地址
     * 
     * @param shippingAddress 收货地址
     * @return 结果
     */
    public int insertShippingAddress(ShippingAddress shippingAddress);

    /**
     * 修改收货地址
     * 
     * @param shippingAddress 收货地址
     * @return 结果
     */
    public int updateShippingAddress(ShippingAddress shippingAddress);

    /**
     * 删除收货地址
     * 
     * @param id 收货地址主键
     * @return 结果
     */
    public int deleteShippingAddressById(Long id);

    /**
     * 批量删除收货地址
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteShippingAddressByIds(Long[] ids);

    @Update("update shipping_address set default_flag=#{defaultFlag} where customer_id=#{customerId}")
    int updateDefaultFlagByCustomerId(@Param("defaultFlag")String defaultFlag, @Param("customerId")Long customerId);
}
